<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        *{
            margin: 0;padding: 0;
        }
        .box{
            width:800px ;
            /* 640px + 40px * 4 =  */
            height: 320px;
            border: 1px solid #000;
            margin: 100px auto;
            overflow: hidden;
        }
        .box div{
            width: 160px;
            height: 320px;
            background: green;
            float: left;
            transition: 1s
        }
        .box:hover div{
            width: 40px;
        }
        .box div:hover{
            width: 640px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div>
            <img src="img/img1.jpg" alt="">
        </div>
        <div>
            <img src="img/img2.jpg" alt="">
        </div>
        <div>
            <img src="img/img3.jpg" alt="">
        </div>
        <div>
            <img src="img/img4.jpg" alt="">
        </div>
        <div>
            <img src="img/img5.jpg" alt="">
        </div>
    </div>
</body>
</html>